package org.apache.flink.runtime.resourceconsumer;

import java.util.Map;

import org.apache.flink.runtime.allocatedeploy.execution.ExecutionID;
import org.apache.flink.runtime.clusterframework.types.ResourceID;

/** A tracker for deployed executions. */
public interface ExecutionDeploymentTracker {

    /**
     * Starts tracking the given execution that is being deployed on the given host.
     *
     * @param executionAttemptId execution to start tracking
     * @param host hosting task executor
     */
    void startTrackingPendingDeploymentOf(ExecutionID executionId, ResourceID host);

    /**
     * Marks the deployment of the given execution as complete.
     *
     * @param executionAttemptId execution whose deployment to mark as complete
     */
    void completeDeploymentOf(ExecutionID executionId);

    /**
     * Stops tracking the given execution.
     *
     * @param executionAttemptId execution to stop tracking
     */
    void stopTrackingDeploymentOf(ExecutionID executionId);

    /**
     * Returns all tracked executions for the given host.
     *
     * @param host hosting task executor
     * @return tracked executions
     */
    Map<ExecutionID, ExecutionDeploymentState> getExecutionsOn(ResourceID host);
}
